import request from '../request'
import qs from 'querystring'

const LIST_PATH = 'categories'
const ADD_PATH = 'categories'
//分类列表 params为参数对象
function cateList(params) {
    return request({
        url: LIST_PATH + "?" + qs.stringify(params),
        method: 'get',
    })
}
//添加分类 params为参数对象
function addCate(obj) {
    return request({
        url: ADD_PATH,
        method: 'post',
        data: obj
    })
}

/* 编辑分类 */
function editCate(id,obj) {
    return request({
        url: `categories/${id}`,
        method: 'put',
        data:obj,
    })
}


export { cateList, addCate , editCate }